/*
 * @Author: ReinerLau lk850593913@gmail.com
 * @Date: 2022-09-14 17:17:57
 * @LastEditors: ReinerLau lk850593913@gmail.com
 * @LastEditTime: 2022-09-15 10:20:24
 * @FilePath: \robot\src\utils\importJS.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
export default function importJS(src) {
  return new Promise((resolve, reject) => {
    const body = document.getElementsByTagName("body")[0];
    const script = document.createElement("script");
    script.type = "text/javascript";
    script.onload = () => {
      resolve();
    };
    script.onerror = () => {
      reject();
    };
    script.src = src;
    body.appendChild(script);
  });
}
